package org.ventura.sistemafinanciero.entity;

// Generated 02-may-2014 11:48:28 by Hibernate Tools 4.0.0

import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * TipoDocumento generated by hbm2java
 */
@Entity
@Table(name = "PROVINCIA", schema = "BDSISTEMAFINANCIERO")
@XmlRootElement(name = "pais")
@XmlAccessorType(XmlAccessType.NONE)
@NamedQueries({
		@NamedQuery(name = Provincia.findByIdDepartamento, query = "SELECT p FROM Provincia p WHERE p.departamento.idDepartamento = :iddepartamento order by p.denominacion"),
		@NamedQuery(name = Provincia.findCodigoDepartamento, query = "SELECT p FROM Provincia p WHERE p.departamento.codigo = :codigoDepartamento order by p.denominacion") })
public class Provincia implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public final static String findByIdDepartamento = "Provincia.findByIdDepartamento";
	public final static String findCodigoDepartamento = "Provincia.findCodigoDepartamento";

	private BigInteger idProvincia;
	private String denominacion;
	private String abreviatura;
	private String codigo;
	private Departamento departamento;
	private Set distritos = new HashSet(0);

	public Provincia() {
	}

	@XmlElement(name = "id")
	@Id
	@Column(name = "ID_PROVINCIA", unique = true, nullable = false, precision = 22, scale = 0)
	public BigInteger getIdProvincia() {
		return this.idProvincia;
	}

	public void setIdProvincia(BigInteger idProvincia) {
		this.idProvincia = idProvincia;
	}

	@XmlElement
	@Column(name = "DENOMINACION", length = 100, columnDefinition = "nvarchar2")
	public String getDenominacion() {
		return this.denominacion;
	}

	public void setDenominacion(String denominacion) {
		this.denominacion = denominacion;
	}

	@XmlElement
	@Column(name = "ABREVIATURA", length = 5, columnDefinition = "nvarchar2")
	public String getAbreviatura() {
		return this.abreviatura;
	}

	public void setAbreviatura(String abreviatura) {
		this.abreviatura = abreviatura;
	}

	@XmlElement
	@Column(name = "CODIGO", length = 3, columnDefinition = "nvarchar2")
	public String getCodigo() {
		return this.codigo;
	}

	public void setCodigo(String codigo) {
		this.codigo = codigo;
	}

	@XmlTransient
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_DEPARTAMENTO", nullable = false)
	public Departamento getDepartamento() {
		return departamento;
	}

	public void setDepartamento(Departamento departamento) {
		this.departamento = departamento;
	}

	@XmlTransient
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "provincia")
	public Set<Distrito> getDistritos() {
		return distritos;
	}

	public void setDistritos(Set distritos) {
		this.distritos = distritos;
	}

}
